import React,{useEffect,useContext} from 'react';
import {observer} from 'mobx-react-lite';
import contextStore from '../../../context/store';
import {Link} from 'react-router-dom';

const My:React.FC = observer(function(){
    let {User} = useContext(contextStore);
    useEffect(() => { //componentDidMount
        User.getLoginStatus()
    },[])
    return <div>
        {
            User.isLogin ? <div>登录状态</div> : <div>
                <Link to="/login">登录</Link>
                <Link to="/registry">注册</Link>
            </div>
        }
        <div>
            <Link to="/list">我创建的投票</Link>
            <Link to="/list">我参与的投票</Link>
            <Link to="/create">+</Link>
        </div>
    </div>
})

export default My